from pyspark.sql import SparkSession

if __name__ == '__main__':
    spark = SparkSession.builder. \
        appName("test"). \
        master("local[*]"). \
        getOrCreate()

    sc = spark.sparkContext

    # csv
    df = spark.read.format("csv") \
        .option("sep", ", ") \
        .option("header", True) \
        .option("encoding", "utf-8") \
        .schema("name string, age int") \
        .load("../data/input/sql/people.csv")
    df.printSchema()
    df.show()
